//
//  BSPublishButton.m
//  BaiSi
//
//  Created by Sycamore on 16/5/24.
//  Copyright © 2016年 Sycamore. All rights reserved.
//

#import "BSPublishButton.h"

@implementation BSPublishButton


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (!self) {
        return nil;
    }
//    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.titleLabel.font = [UIFont systemFontOfSize:16];
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.imageView.bs_Y = BSSmallMargin;
    //注意,center是相对父控件来计算的！
    self.imageView.bs_centerX = [self convertPoint:self.center fromView:self.superview].x;
    
    self.titleLabel.bs_centerX = self.bs_width * 0.5;
    self.titleLabel.bs_Y = CGRectGetMaxY(self.imageView.frame) + BSSmallMargin ;
    
    //自动计算宽和高
    [self.titleLabel sizeToFit];
    
}
@end
